<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:50:"D:\Code\lvyou/application/admin\view\bp\index.html";i:1533536338;s:55:"D:\Code\lvyou\application\admin\view\public\header.html";i:1534833010;s:55:"D:\Code\lvyou\application\admin\view\public\footer.html";i:1532913947;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo config('WEB_SITE_TITLE'); ?></title>
    <link href="/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/static/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/static/admin/css/animate.min.css" rel="stylesheet">
    <link href="/static/admin/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="/static/admin/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="/static/layui/css/layui.css" rel="stylesheet">
    <link href="/static/admin/css/admin.css" rel="stylesheet">
    <script src="/static/admin/js/jquery.min.js?v=2.1.4"></script>
    <style type="text/css">
        .long-tr th {
            text-align: center
        }

        .long-td td {
            text-align: center
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>引导页</h5>
        </div>
        <div class="ibox-content">
            <?php if(($data)): ?>
            <img style="width: 1000px" class="img" src="<?php echo $data['src']; ?>">
            <?php endif; ?>
            <!-- End Example Pagination -->
            <input type="hidden" class="id" value="<?php echo $data['id']; ?>">
            
            <button style="display: block;" type="button" class="layui-btn" id="test1">
                <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
            <!--<button style="display: block" class="layui-btn layui-btn-warm layui-btn-radius edit">更换图片</button>-->

        </div>
    </div>
</div>
<!-- End Panel Other -->
</div>

<script src="/static/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/static/admin/js/lunhui.js"></script>
<script src="/static/layui/layui.all.js"></script>

<script>
        $('.edit').click(function () {

        });
        layui.use('upload', function(){
            var upload = layui.upload;

            //执行实例
            var uploadInst = upload.render({
                elem: '#test1' //绑定元素
                ,url: '/admin/upload/upload' //上传接口
                ,done: function(res){
                    //上传完毕回调
                    if(res.code == 200){
                        edit_ajax(res.data.src)
                        // $('#src').attr('value',res.data.src);
                        // $('#img').attr('src',res.data.src);
                        // $('#img').css('display','');
                        // layer.msg('上传成功', {icon: 1});
                    }else {
                        layer.msg(res.msg, {icon: 2});
                    }

                }
                ,error: function(){
                    //请求异常回调
                }
            });
        });
        function edit_ajax(src) {
            var id = $('.id').val();
            $.post('/admin/bp/edit_src',{src:src,id:id},function (data) {
                if(data.code == 200){
                    $('.img').attr('src',src);
                }else {
                    layer.msg(res.msg, {icon: 2});
                }

            },'json');
        }
</script>


</body>
</html>